<template>
  <div>
    <el-table
      v-loading="listLoading"
      :data="list"
      :element-loading-text="elementLoadingText"
    >
      <el-table-column
        align="center"
        prop="name"
        label="规则名称"
        min-width="80"
      ></el-table-column>
      <el-table-column
        align="center"
        label="备注"
        min-width="380"
      >
        <template #default="{ row }">
          <div>{{ row.rate }}</div>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="intro"
        label="操作"
        min-width="120"
      >
        <template #default="{ row }">
          <el-button type="text" @click="handleEdit(row)">编辑</el-button>
          <el-button type="text" @click="handleDelete(row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  props: {
    loading: {
      type: Boolean,
      default: false
    },
    list: {
      type: Array,
      default() {
        return []
      }
    }
  },
  model: {
    prop: 'loading'
  },
  watch: {
    listLoading(val) {
      this.$emit('input', val)
    },
    loading(val) {
      this.listLoading = val
    }
  },
  data() {
    return {
      elementLoadingText: '正在加载...'
    }
  },
  methods: {
    handleEdit() {},
    handleDelete() {},
  }
}
</script>